package com.zyd.shiro.persistence.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.zyd.shiro.persistence.beans.UserAddress;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 数据访问接口
 * @author Administrator
 *
 */
public interface MallUserAddressDao extends JpaRepository<UserAddress,Integer>,JpaSpecificationExecutor<UserAddress>{


    @Query(value = "select * from mall_user_address address where address.user_id = ?1",nativeQuery =  true)
    public List<UserAddress> findByUser_id(Integer user_id);

    @Query(value = "select * from mall_user_address address where address.user_id = ?1 AND address.id =?2 ",nativeQuery =  true)
    public UserAddress findByUser_idAndId(Integer userId,Integer addressId);
}
